From: Matthieu Gallien Date: Thu, 6 Mar 2025 15:24:13 +0000 (+0100) Subject: avoid showing warnings for excluded files to not confuse users X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~1^2~21^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=d530ce3dc394f30299ac6ca241e3cd8b9dab5dd2;p=nextcloud-desktop.git avoid showing warnings for excluded files to not confuse users if a file name is invalid, the files will be ignored if a file is excluded because of selective sync, the file will be ignored if a file is ignored for those both reasons, avoid showing a very visible warning to the user will limit too many warnings and notifications being shown Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 2e4fa09da..ce8ef8d30 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -245,12 +245,16 @@ void ProcessDirectoryJob::process() checkAndUpdateSelectiveSyncListsForE2eeFolders(path._server + "/"); } - if (_queryServer == InBlackList || _discoveryData->isInSelectiveSyncBlackList(path._original) || isEncryptedFolderButE2eIsNotSetup) { - processBlacklisted(path, e.localEntry, e.dbEntry); + const auto isBlacklisted = _queryServer == InBlackList || _discoveryData->isInSelectiveSyncBlackList(path._original) || isEncryptedFolderButE2eIsNotSetup; + + const auto willBeExcluded = handleExcluded(path._target, e, entries, isHidden, isBlacklisted); + + if (willBeExcluded) { continue; } - if (handleExcluded(path._target, e, entries, isHidden)) { + if (isBlacklisted) { + processBlacklisted(path, e.localEntry, e.dbEntry); continue; } @@ -266,7 +270,7 @@ void ProcessDirectoryJob::process() QTimer::singleShot(0, _discoveryData, &DiscoveryPhase::scheduleMoreJobs); } -bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &entries, const std::map &allEntries, bool isHidden) +bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &entries, const std::map &allEntries, const bool isHidden, const bool isBlacklisted) { const auto isDirectory = entries.localEntry.isDirectory || entries.serverEntry.isDirectory; @@ -497,7 +501,13 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent } _childIgnored = true; - emit _discoveryData->itemDiscovered(item); + + if (isBlacklisted) { + emit _discoveryData->silentlyExcluded(path); + } else { + emit _discoveryData->itemDiscovered(item); + } + return true; } diff --git a/src/libsync/discovery.h b/src/libsync/discovery.h index a18fc6014..ae886cae4 100644 --- a/src/libsync/discovery.h +++ b/src/libsync/discovery.h @@ -148,7 +148,7 @@ private: // return true if the file is excluded. // path is the full relative path of the file. localName is the base name of the local entry. - bool handleExcluded(const QString &path, const Entries &entries, const std::map &allEntries, bool isHidden); + bool handleExcluded(const QString &path, const Entries &entries, const std::map &allEntries, bool isHidden, bool isBlacklisted); bool canRemoveCaseClashConflictedCopy(const QString &path, const std::map &allEntries);